//
//  YBSelectPeopleNormalTableViewCell.m
//  GongXinDangJian
//
//  Created by apple on 17/11/30.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YBSelectPeopleNormalTableViewCell.h"

@interface YBSelectPeopleNormalTableViewCell ()
@property (nonatomic , strong) UILabel * nameLabel;

@property (nonatomic , strong) UIImageView * selectImageView;
@end

@implementation YBSelectPeopleNormalTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self ybInitMyCell];
    }
    return self;
}

-(void)ybInitMyCell{
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.selectImageView];
    UIView * lineView = [[UIView alloc]initWithFrame:CGRectMake(0, ItemHeight * 80 - 1, [UIScreen zj_screenWith], 1)];
    lineView.backgroundColor = [UIColor themeGrayColor];
    [self.contentView addSubview:lineView];
    
}

-(void)setModel:(YBPeopleInfoModel *)model
{
    _model = model;
    self.cellSelected = model.ISSELECT;
    self.nameLabel.text = [ToolClass returnNoNullStringWithString:model.NAME];
}

-(void)setIsOrg:(BOOL)isOrg
{
    _isOrg = isOrg;
    if (isOrg) {
        self.nameLabel.frame = CGRectMake(ItemWidth * 30, 0, [UIScreen zj_screenWith] - ItemWidth * 176, ItemHeight * 80);
    }
}


-(void)setCellSelected:(BOOL)cellSelected
{
    _cellSelected = cellSelected;
    if (cellSelected) {
        self.selectImageView.image = [UIImage imageNamed:@"list_selected"];
    }
    else{
        self.selectImageView.image = [UIImage imageNamed:@"list_select"];
    }
}

-(UILabel *)nameLabel
{
    if (!_nameLabel) {
        _nameLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 85, 0, [UIScreen zj_screenWith] - ItemWidth * 157, ItemHeight * 80) font:16 textColor:[UIColor textBlackColor] text:@""];
    }
    return _nameLabel;
}


-(UIImageView *)selectImageView
{
    if (!_selectImageView) {
        _selectImageView = [[UIImageView alloc]initWithFrame:CGRectMake([UIScreen zj_screenWith] - ItemHeight * 72, (ItemHeight * 80 - ItemWidth * 42) / 2, ItemWidth * 42, ItemWidth * 42)];
        _selectImageView.image = [UIImage imageNamed:@"list_select"];
    }
    return _selectImageView;
}



@end
